<?php
/*
 * 域名中介
 *
 */
class EscrowAction extends BaseAction{
	public function index(){
		$this->display();
	}
        
//        添加中介交易
        public function new_deal(){
            $order = M('Order');
            if($_POST){
                if($_POST['dprice'] == 'buy'){
                    $data['sell_id'] = $_POST['user'];
                    $data['buy_id'] = $this->user_session['uid'];
                    $data['yes_no'] = 2;
                }  else {
                    $data['buy_id'] = $_POST['user'];
                    $data['sell_id'] = $this->user_session['uid'];
                    $data['yes_no'] = 1;
                }
                if($_POST['roledprice'] == 'one'){
                    $data['payTye'] = 1;
                }  elseif ($_POST['roledprice'] == 'two') {
                    $data['payTye'] = 2;
                }  elseif ($_POST['roledprice'] == 'three') {
                    $data['payTye'] = 3;
                }
                $data['total_price'] = $_POST['money'];
                $data['trade_type'] = 1;
                $data['domainName'] = $_POST['domainName'];
                $data['staff_id'] = $this->user_session['staff_uid'];
                $data['addTime'] = time();
                if($data['staff_id']){
                    $data['status'] = 1;
                }
                $row = $order->add($data);
                if($row){
                    $this->success('添加成功',U('Escrow/index'));
                }  else {
                    $this->error('添加失败');
                }
            }
        }
}